AC_INIT([godotapkfixer)], [1.0])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_MACRO_DIRS([m4])
AC_PROG_CC
AC_PROG_CXX
AC_CANONICAL_HOST
AM_PROG_AR
LT_INIT

AX_CXX_COMPILE_STDCXX_11(, [mandatory])

os_linux=no
os_windows=no
os_mac=no

# Detect the target system
case "${host_os}" in
    linux*)
        os_linux=yes
        ;;
    cygwin*|mingw*)
        os_windows=yes
        ;;
    darwin*)
        os_mac=yes
        ;;
    *)
        AC_MSG_ERROR(["OS $host_os is not supported"])
        ;;
esac

AC_ARG_ENABLE([static-binary],
    AS_HELP_STRING([--enable-static-binary], [enable static build]),
    [
    EXTRA_LDFLAGS="-all-static"
    AX_CHECK_LINK_FLAG([-static-libgcc], [EXTRA_LDFLAGS="${EXTRA_LDFLAGS} -static-libgcc"])
    AX_CHECK_LINK_FLAG([-static-libstdc++], [EXTRA_LDFLAGS="${EXTRA_LDFLAGS} -static-libstdc++"])
    ])

AC_SUBST(EXTRA_LDFLAGS)

AM_CONDITIONAL([LINUX], [test "$os_linux" = "yes"])
AM_CONDITIONAL([WINDOWS], [test "$os_windows" = "yes"])
AM_CONDITIONAL([OSX], [test "$os_mac" = "yes"])

AC_CONFIG_FILES([
 Makefile
])

AC_OUTPUT
